from rest_framework import serializers

from goods.models import SKU
from orders.models import OrderInfo, OrderGoods

class OrderSKUSerializer(serializers.ModelSerializer):

    class Meta:
        model = SKU
        fields = ('name','default_image_url')

class OrderDetailSerializer(serializers.ModelSerializer):

    sku = OrderSKUSerializer()

    class Meta:
        model = OrderGoods
        fields = '__all__'

class OrderSerializer(serializers.ModelSerializer):

    skus = OrderDetailSerializer(many=True)

    class Meta:
        model = OrderInfo
        fields = '__all__'
        # fields = ['order_id','status']


